Component({
  mixins: [],
  data: {
    checkedIndex: ''
  },
  props: {
    showPopup: false,
    popupTitle: '',
    list: []
  },
  didMount() {
  },
  didUpdate() { },
  didUnmount() { },
  methods: {
    setCheck(e) {
      const index = e.currentTarget.dataset.index;
      const { list } = this.props;
      list.forEach((element, idx) => {
        if (idx == index) {
          element.checked = true;
        } else {
          element.checked = false;
        }
      });
      this.setData({
        list,
        checkedIndex: index
      });
    },
    onPopupClose() {
      this.props.onClosePicker();
    },
    radioChange(e) {
      this.setData({
        checkedIndex: e.detail.value
      })
    },
    submit() {
      this.props.onSetValue(this.data.checkedIndex);
    }
  },
});
